package com.parkinginfo.manager;

/*
 * Author: Deepika Gohil
 * 
 */

import java.util.ArrayList;
import java.util.Arrays;

import com.parkinginfo.dbhelper.Place;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageButton;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class ListViewer extends Activity 
{
	private ListView lv;
	private ParkingAdapter m_adapter;
	int scrollIndex = -1;
	int scrollTop;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.parkinglist_with_title);  
		
		lv = (ListView) findViewById( R.id.mainListView );  
        //ListView lv = getListView();
		this.m_adapter = new ParkingAdapter(this, R.layout.listing_items, (((ParkingManagerApplication)getApplication()).parkingGarages));
		lv.setAdapter(this.m_adapter);
        lv.setTextFilterEnabled(true);
        
        lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view,int position, long id) 
            {
            	Intent it = new Intent(view.getContext(), ParkingDetailsActivity.class);
    			it.putExtra("id", position);
	        	startActivity(it);
            }
          });
        
        
	    ImageButton maps_view = (ImageButton) findViewById(R.id.go_mapview);
	    maps_view.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) 
			{
				Intent it = new Intent(getApplicationContext(),GoogleParkingActivity.class);
				startActivity(it);
			};
		});
		
	}
}
